package com.client.mapper;

import com.client.entity.auth.Operator;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface OperatorDao {
    //查询所有
    @Select("select * from operator ")
    List<Operator> queryAll();

    //按编号查询
    @Select("select * from operator where id = #{ id }")
    Operator queryById(@Param("id") long id);

    //按name查询
    @Select("select * from operator where name = #{ name }")
    Operator queryByName(@Param("name") String name);

    //按编号修改
    @Update("update operator set name= #{name} where id=#{id} ")
    void updatebyId(@Param("id") long id,@Param("name") String name);

    //增加
    @Insert("insert into operator values( #{id},#{name})")
    void add(@Param("id") long id,@Param("name") String name);

    //按编号删除
    @Delete("delete from operator where id = #{id}")
    void deleteByName(@Param("id") long id);

    //删除所有
    @Delete("delete from operator")
    void deleteAll();
}
